package enumdemo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @Author 12629
 * @Description：
 */
public class Test {


    public static void reflectPrivateConstructor() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {

        Class<?> c1 = Class.forName("enumdemo.TestEnum");


        Constructor<?> constructor = c1.getDeclaredConstructor(String.class,int.class,String.class,int.class);
        constructor.setAccessible(true);

        TestEnum testEnum = (TestEnum)constructor.newInstance("草原绿",9);

        System.out.println(testEnum);

    }

    public static void main(String[] args) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
        reflectPrivateConstructor();
    }
}
